﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace yearmonth
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("请输入年/月/日:");
            string str = Console.ReadLine();
            //拆分字符串
            char[] separtor = { '/' };//数组定义形式
            str.Split(separtor);//Split方法的用法
            String[] strArr = str.Split(separtor);
            int month = int.Parse(strArr[1]);//转化
            int sum = 0;
            int year = int.Parse(strArr[0]);
            int day = int.Parse(strArr[2]);
            switch (month)
            {

                case 1:
                    sum = 0 + day;
                    break;
                case 2:
                    sum = 31 + day;
                    //判断闰年;
                    if (year % 400 == 0 || (year % 4 == 0 && year % 100 != 0))
                    {
                        sum += 1;
                        Console.WriteLine("是闰年");
                    }
                    else
                    {
                        Console.WriteLine("不是闰年");
                    }
                    break;
                case 3:
                    sum = 59 + day;
                    break;
                case 4:
                    sum = 90 + day;
                    break;
                case 5:
                    sum = 120 + day;
                    break;
                case 6:
                    sum = 151 + day;
                    break;
                case 7:
                    sum = 181 + day;
                    break;
                case 8:
                    sum = 212 + day;
                    break;
                case 9:
                    sum = 243 + day;
                    break;
                case 10:
                    sum = 273 + day;
                    break;
                case 11:
                    sum = 304 + day;
                    break;
                case 12:
                    sum = 334 + day;
                    break;
            }

            //计算
            Console.WriteLine("这是一年中的第{0}天", sum);
        }
    }
}

